package com.Lyy.Dao;

import com.Lyy.Entity.Book;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component;

import java.util.List;

public interface BookMapper {
    @Select("select * from book2.book")
    List<Book> SelectBookAll();
    @Select("select * from book2.book where bookName like '%${bookName}%'")
    List<Book> SelectBookByName(String bookName);
    @Select("select book_id bookId,book_name bookName,book_author bookAuthor from book.books where book_id = #{id}")
    Book SelectBookById(int id);

    @Update("update book.books set book_name = #{bookName},book_author=#{bookAuthor} where book_id=#{id}")
    int UpdateBook(Book book);
    @Delete("delete from book.books where book_id = #{id}")
    int DeleteBook(int id);
    @Insert("insert into books (book_name, book_author) values (#{bookName},#{bookAuthor})")
    int InsertBook(Book book);
}
